package com.count.rule;

import com.count.number.SpecialNumber;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ZhongGang
 * Date: 14-5-4
 * Time: 下午2:52
 */
public class TimesSpecialNumberRule implements SpecialNumberRule {

    @Override
    public String count(Integer number, List<SpecialNumber> specialNumbers) {
        for (SpecialNumber specialNumber : specialNumbers) {
            if (number % specialNumber.getNumber() == 0) {
                return specialNumber.getWord();
            }
        }
        return null;
    }
}
